package com.ourteam.product.requirement.api;

import com.ourteam.frame.web.AbstractSearchModel;
import com.ourteam.product.requirement.dao.IProductFeatureCheckListDAO;
import com.ourteam.product.requirement.dao.ProductFeatureCheckListDAOQueryBean;
import com.ourteam.product.requirement.domain.ProductFeatureCheckListBean;

public class ProductFeatureCheckListSearchModel extends AbstractSearchModel<ProductFeatureCheckListDAOQueryBean> {

	private long productFeatureId;

	public long getProductFeatureId() {
		return productFeatureId;
	}

	public void setProductFeatureId(long productFeatureId) {
		this.productFeatureId = productFeatureId;
	}

	@Override
	public String getMappedDAOField(String aProperty) {
		return ProductFeatureCheckListBean.getMappedDAOField(aProperty);
	}

	@Override
	protected void doBuildQueryBean(ProductFeatureCheckListDAOQueryBean queryBean) throws Exception {

		ProductFeatureCheckListDAOQueryBean.Criteria criteria = queryBean.createCriteria();

		if (this.productFeatureId != 0) {
			criteria.andProductFeatureIdEqualTo(productFeatureId);
		}
		
		queryBean.setSortProperty(IProductFeatureCheckListDAO.SortIndex);

	}

}
